import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
// import {Message} from 'element-ui'

Vue.use(ElementUI)


Vue.config.productionTip = false
Vue.prototype.axios
// //请求地址
let baseUrl = '/api'
Vue.prototype.$baseUrl = 'http://10.108.37.62:9001'
axios.defaults.baseURL = baseUrl
    //axios.defaults.headers.common['token'] = localStorage.getItem('token')
    // axios.defaults.withCredentials = true//登录携带令牌

Vue.prototype.$http = (url, method, data, async, fun) => {
    axios({
        url: url,
        method: method,
        data: JSON.stringify(data),
        async: async
    }).then(resp => {

        fun(resp.data)
    }).catch(err => {
        console.log(err)
    })
}

Vue.prototype.$http_formdata = (url, method, data, async, fun,fail) => {
    axios({
        url: url,
        method: method,
        data: data,
        async: async
    }).then(resp => {
        fun(resp.data)
    }).catch(err => {
        fail(err)
    })
}

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
